package me.qi.kancha.controller;

import me.qi.kancha.applet.DataStore;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 小程序 session key
 *
 * @author sun
 * @date 2021/12/16 17:54
 * @modified By：
 */
@Slf4j
@RestController
@RequestMapping("/skey")
public class AppletSessionKeyController {

    @Autowired
    private DataStore dataStore;

    /**
     * 获取小程序 session k
     *
     */
    @GetMapping(value = "/{appid}/{openid}")
    public String getSessionKey(@PathVariable String appid, @PathVariable String openid) {
        return dataStore.readSessionKey(appid, openid);
    }
}
